await

public abstract MediaReceiver await(Predicate<MediaReceiver> predicate)

Blocks the current thread until the first receiver matching the predicate is discovered.

If a matching receiver has already been discovered, returns it immediately.

Example of usage:


browser.set(StartPresentationCallback.class, (params, tell) -> {
    params.mediaReceivers().refresh();
    MediaReceiver receiver = params.mediaReceivers().await(mediaReceiver -> {
        return mediaReceiver.name().startsWith("Samsung TV");
    });
    tell.start(receiver);
});

Return

the first discovered receiver matching the predicate

Throws

when the profile is deleted or its engine is closed

when the receiver has not been discovered within 45 seconds


public abstract MediaReceiver await(Predicate<MediaReceiver> predicate, Duration timeout)

Blocks the current thread until the first receiver matching the predicate is discovered.

If a matching receiver has already been discovered, returns it immediately.

Return

the first discovered receiver matching the predicate

Throws

when the profile is deleted or its engine is closed

when the receiver has not been discovered within timeout